﻿@model Amazon_Book_Search.Models.SearchPage 
@{
    ViewBag.Title = "Search";
}

<div>
    @using (Html.BeginForm("Search", "Search", FormMethod.Get)) {   
         <p> Title: @Html.TextBox("q") 
         <input type="submit" value="Search" /></p>
        }

    @if (Model.Items.Count != 0)
    {     
    <table>
        <tr>
            <th>Kirjeldus</th>
            <th>Hind</th>
        </tr>
        @foreach (var item in Model.Items)
        {
            <tr>
                <td>
                @if (item.Review != null)
                {
                    foreach (var x in item.Review)
                    {
                        <p>@item.Review.Last().Content.ToString()</p>
                    }
                }
                else
                {<p>ei leitud</p>}
                </td>
                <td>@if (item.Price != null)
                    {
                    <p>@item.Price</p>
                    }
                    else
                    {<p>ei leitud</p>}</td>
            </tr>
        }
    </table>
    }

   

</div>
